package com.aust.dynamicProxy.test4;

public class Test {
    public static void main(String[] args) throws Exception {
        Calculator calculator = new CalculatorImpl();
        Calculator proxyAdmin = (Calculator) ProxyUtil.createProxy(calculator, "admin");
        System.out.println(proxyAdmin.add(1, 2));
        System.out.println();
        System.out.println(proxyAdmin.sub(1, 2));
        System.out.println();
        System.out.println(proxyAdmin.mul(1, 2));
        System.out.println();
        System.out.println(proxyAdmin.div(1, 2));
        System.out.println("==========================");
        Calculator proxyUser = (Calculator) ProxyUtil.createProxy(calculator, "user");
        System.out.println(proxyUser.add(2, 1));
        System.out.println();
        System.out.println(proxyUser.sub(2, 1));
        System.out.println();
        System.out.println(proxyUser.mul(2, 1));
        System.out.println();
        System.out.println(proxyUser.div(2, 1));
    }
}
